<?php

namespace App\Http\Requests\User;

use Illuminate\Foundation\Http\FormRequest;

class CreateForm extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'=>'required|between:2,8|unique:manager_users,name',
            'email'=>'required|email|unique:manager_users,email',
            'cn_nickname'=>['required','between:2,8','regex:/^[\x{4e00}-\x{9fa5}]+$/u'],
            'en_nickname'=>'required|between:2,8|alpha_dash',
            'mobile_phone'=>['required','size:11','regex:/^[0-9]{11}$/'],
            'qq_no'=>['required','size:5','regex:/^[0-9]{5}$/'],
            'password'=>'required|min:8|confirmed',
        ];
    }
}
